﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using Clarendon.AzureBilling.Library;
using System.Timers;

namespace Clarendon.AzureBilling.Server
{
    class Program
    {
        private static ServiceHost _host; 

        static void Main(string[] args)
        {
            Console.WriteLine("setting up web service duplex endpoint ...");
            _host = new ServiceHost(typeof(AzureBillingService));
            _host.Open();
            Console.WriteLine("finished setting up web service duplex endpoint ...");

            var timer = new Timer(1000*60*10)
                              {
                                  AutoReset = true,
                                  Enabled = true,
                                  Interval = 1000*60*3
                              };
            timer.Elapsed += new ElapsedEventHandler(TimerElapsed);
            timer.Start();

            Console.WriteLine("waiting for client response - press [ENTER] to exit");
            Console.ReadLine();
        }

        static void TimerElapsed(object sender, ElapsedEventArgs e)
        {
            var loader = new AzureServiceLoader();
            loader.GetLoaded();
        }
    }
}
